import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getDepartListAPI } from '@/http/depart'
import type { DepartListArrType, DepartlistResType } from '@/interface/depart/departType'

export const useDepartStore = defineStore('depart', () => {
  const departList = ref<DepartListArrType>()

  const getDepartList = async () => {
    try {
      let res: DepartlistResType = await getDepartListAPI()
      departList.value = res.data
    } catch (error) {
      console.log('获取部门列表失败')
    }
  }
  return { departList, getDepartList }
})
